package com.negocio.entidades;

import java.io.Serializable;

import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;

public class MatriculaPK implements Serializable {
	@Id
	@ManyToOne
	@JoinColumn(nullable=false)
	private Usuario aluno;
	
	@Id
	@ManyToOne
	@JoinColumn(nullable=false, referencedColumnName="id")
	private CompCurr cc;

	public Usuario getAluno() {
		return aluno;
	}

	public void setAluno(Usuario aluno) {
		this.aluno = aluno;
	}

	public CompCurr getCc() {
		return cc;
	}

	public void setCc(CompCurr cc) {
		this.cc = cc;
	}
	
	@Override
	public boolean equals(Object mat){
		if(mat instanceof MatriculaPK){
			final MatriculaPK matPK = (MatriculaPK) mat;
			if(!(matPK.getAluno().getId() == this.aluno.getId() && matPK.getCc().getId() == this.cc.getId())){
				return false;
			}
			return true;
		}
		return false;
	}
	
	
	@Override
	public int hashCode(){
		return this.hashCode();
	}
}
